/* 中国传统风格样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'SimSun', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    color: white;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, 30px); }
}

header h1 {
    font-size: 2.8em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    font-weight: 700;
}

header p {
    font-size: 1.2em;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

/* 认证区域 */
.auth-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: #8B4513;
    border-bottom-color: #8B4513;
    font-weight: bold;
}

.tab-btn:hover {
    background: #f8f8f8;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #8B4513;
    font-size: 1.8em;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
    background-color: white;
    cursor: pointer;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #8B4513;
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

select:hover {
    border-color: #8B4513;
}

select option {
    padding: 10px;
    background-color: white;
    color: #333;
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
}

/* 主应用区域 */
.main-app {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* 算命区域 */
.fortune-section {
    margin-bottom: 40px;
}

.fortune-section h2 {
    color: #8B4513;
    margin-bottom: 25px;
    font-size: 1.8em;
    text-align: center;
}

/* 结果区域 */
.result-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
    border-left: 5px solid #8B4513;
}

.result-section h3 {
    color: #8B4513;
    margin-bottom: 20px;
    font-size: 1.5em;
}

#bazi-result {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

#ai-analysis {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    line-height: 1.6;
}

/* Markdown 内容样式 */
.analysis-content {
    line-height: 1.8;
    color: #333;
    max-height: 800px;
    overflow-y: auto;
    padding: 10px;
}

/* 导出PDF时，展开内容以便完整渲染 */
.exporting-pdf .analysis-content {
    max-height: none;
    overflow: visible;
}
.exporting-pdf #ai-analysis {
    box-shadow: none;
}

.analysis-content h1,
.analysis-content h2,
.analysis-content h3,
.analysis-content h4 {
    color: #667eea;
    margin: 25px 0 15px 0;
    font-weight: 700;
    line-height: 1.4;
}

.analysis-content h1 {
    font-size: 1.8em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
    margin-top: 0;
}

.analysis-content h2 {
    font-size: 1.5em;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.analysis-content h3 {
    font-size: 1.3em;
}

.analysis-content h4 {
    font-size: 1.1em;
    color: #555;
}

.analysis-content p {
    margin: 12px 0;
    text-align: justify;
    line-height: 1.8;
}

.analysis-content ul,
.analysis-content ol {
    margin: 15px 0;
    padding-left: 30px;
}

.analysis-content ul {
    list-style-type: disc;
}

.analysis-content ol {
    list-style-type: decimal;
}

.analysis-content li {
    margin: 8px 0;
    line-height: 1.7;
}

.analysis-content li ul,
.analysis-content li ol {
    margin-top: 8px;
    margin-bottom: 8px;
}

.analysis-content strong {
    color: #667eea;
    font-weight: 700;
}

.analysis-content em {
    font-style: italic;
    color: #666;
}

.analysis-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.analysis-content pre {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    overflow-x: auto;
    margin: 15px 0;
}

.analysis-content pre code {
    background: none;
    padding: 0;
    color: #333;
    font-size: 0.9em;
}

.analysis-content blockquote {
    border-left: 4px solid #667eea;
    margin: 20px 0;
    padding: 15px 20px;
    background: #f8f9fa;
    font-style: italic;
    color: #555;
    border-radius: 0 6px 6px 0;
}

.analysis-content a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid #667eea;
}

.analysis-content a:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

.analysis-content hr {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 25px 0;
}

/* 表格样式 */
.analysis-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.analysis-content table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.analysis-content table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.analysis-content table tbody tr {
    background: white;
    transition: background-color 0.2s ease;
}

.analysis-content table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.analysis-content table tbody tr:hover {
    background: #e3f2fd;
}

.analysis-content table td {
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.analysis-content table tbody tr:last-child td {
    border-bottom: none;
}

/* 历史记录区域 */
.history-section h3 {
    color: #8B4513;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.history-item {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #D2691E;
    transition: transform 0.3s ease;
}

.history-item:hover {
    transform: translateX(5px);
}

.history-item h4 {
    color: #8B4513;
    margin-bottom: 10px;
}

.history-item .date {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.history-item .bazi-info {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8B4513;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .user-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .auth-section,
    .main-app {
        padding: 20px;
    }
}

/* 消息提示 */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: bold;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 新增样式 */
.optional {
    color: #999;
    font-weight: normal;
    font-size: 0.9em;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #666;
    font-style: italic;
}

/* AI问答区域 */
.qa-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.qa-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1em;
}

.qa-btn {
    padding: 12px 24px;
    width: auto;
}

.qa-questions {
    margin-top: 20px;
}

.qa-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.qa-item .question {
    color: #667eea;
    font-weight: 600;
    margin-bottom: 10px;
    padding-left: 25px;
    position: relative;
}

.qa-item .question::before {
    content: '❓';
    position: absolute;
    left: 0;
}

.qa-item .answer {
    color: #333;
    line-height: 1.8;
    padding-left: 25px;
    position: relative;
}

.qa-item .answer::before {
    content: '💡';
    position: absolute;
    left: 0;
}

.qa-suggestions {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.qa-suggestions p {
    margin-bottom: 15px;
    color: #666;
    font-weight: 600;
}

.qa-suggestion-btn {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 8px 16px;
    border-radius: 20px;
    margin: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.qa-suggestion-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* 八字显示优化 */
.bazi-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.pillar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.pillar-label {
    display: block;
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 8px;
}

.pillar-value {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.five-elements {
    margin-top: 20px;
}

.elements-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.element {
    background: white;
    padding: 10px 20px;
    border-radius: 20px;
    border: 2px solid #667eea;
    color: #667eea;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 历史记录优化 */
.history-item {
    cursor: pointer;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 时间输入组 */
.time-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-select {
    flex: 1;
    min-width: 80px;
}

.time-separator {
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
    padding: 0 5px;
}
